package yns.springboot.guide.demo.data.db.jdbc.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import yns.springboot.guide.demo.entity.UserEntity;

public class UserRowMapper implements RowMapper<UserEntity> {

	@Override
	public UserEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
		UserEntity userEntity = new UserEntity();
		
		userEntity.setId(rs.getInt("ID"));
		userEntity.setName(rs.getString("Name"));
		userEntity.setSex(rs.getInt("Sex"));
		userEntity.setAge(rs.getInt("Age"));
		userEntity.setDescribe(rs.getString("Describe"));
		
		return userEntity;
	}

}
